/**
 * 
 */
package org.vectrics.recruiter.struts.admin.person;

import javax.servlet.jsp.JspException;

import org.vectrics.cv.Language;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.struts.VectricsActionData;
import org.vectrics.struts.VectricsStrutsAction;

/**
 * @author pgoette
 * 
 * Clase encargada de mostrar los datos de Language para editarlo.
 */
public class EditLanguageAction extends VectricsStrutsAction {


	@Override
	protected String doExecute(VectricsActionData actionData)
			throws JspException {

		String forward = "success";
		// Busco el id
		String idLanguage = actionData.getRequest().getParameter("languageId");
		LanguageForm form = (LanguageForm) actionData.getForm();
		
        if ((idLanguage!=null) && (!idLanguage.trim().equals("")))
		{
        	// Busco la carrera segun el id.
        	Language language = RecruitServiceLocator.getPersonService().findLanguageById(new Long(idLanguage));
        	form.setId(language.getId().toString());
        	form.setName(language.getName());
		}
        
		return forward;
	}

}
